/*
 * SubServerWindow.java
 *
 * Created on August 20, 2006, 6:22 PM
 */

package org.letva.copie.subserver.gui;
import javax.swing.*;
import org.letva.copie.subserver.*;
import java.net.*;
import java.io.*;
/**
 *
 * @author  Vuk Nikolic
 */
public class SubServerWindow extends javax.swing.JFrame {
    
    /** Creates new form SubServerWindow */
    public SubServerWindow() {
        setLookAndFeel();
        initComponents();
        
        // napravili smo subServer, ajde da ga startujemo
        // medjutim nit koja komunicira sa mainServerom radi tek
        // kada se klikne na connect to main server
        
        String fileName = "log.txt";
        mySubServer = new SubServer(this, 7772, 7771, 7770, fileName);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        connectToMainServerDialog = new javax.swing.JDialog();
        connectToMainServerPanel = new javax.swing.JPanel();
        ipAddressLabel = new javax.swing.JLabel();
        portLabel = new javax.swing.JLabel();
        portTextField = new javax.swing.JTextField();
        ipAddressTextField = new javax.swing.JTextField();
        connecToMainServertButton = new javax.swing.JButton();
        activateSubServerDialog = new javax.swing.JDialog();
        activateSubServerPanel = new javax.swing.JPanel();
        subServerPortLabel = new javax.swing.JLabel();
        subServerPortTextField = new javax.swing.JTextField();
        clientPortTextField = new javax.swing.JTextField();
        clientPortLabel = new javax.swing.JLabel();
        settingsButton = new javax.swing.JButton();
        infoDialog = new javax.swing.JDialog();
        infoPanel = new javax.swing.JPanel();
        infoLabel = new javax.swing.JLabel();
        infoButton = new javax.swing.JButton();
        upperPanel = new javax.swing.JPanel();
        numberOfConnectedClientsLabel = new javax.swing.JLabel();
        mainServerLabel = new javax.swing.JLabel();
        connectedClientsLabel = new javax.swing.JLabel();
        mainServerStatusLabel = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        showLogDialogItem = new javax.swing.JMenuItem();
        connectToMainServerItem = new javax.swing.JMenuItem();
        activateSubServerItem = new javax.swing.JMenuItem();
        exitItem = new javax.swing.JMenuItem();

        connectToMainServerDialog.setTitle("Connect To Main Server");
        ipAddressLabel.setText("IP address:");

        portLabel.setText("Port:");

        portTextField.setText("7772");

        ipAddressTextField.setText("10.0.0.6");

        connecToMainServertButton.setText("Connect");
        connecToMainServertButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                connecToMainServertButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout connectToMainServerPanelLayout = new org.jdesktop.layout.GroupLayout(connectToMainServerPanel);
        connectToMainServerPanel.setLayout(connectToMainServerPanelLayout);
        connectToMainServerPanelLayout.setHorizontalGroup(
            connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(connectToMainServerPanelLayout.createSequentialGroup()
                .add(22, 22, 22)
                .add(connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(ipAddressLabel)
                    .add(portLabel))
                .add(15, 15, 15)
                .add(connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(portTextField)
                    .add(ipAddressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 161, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(19, 19, 19)
                .add(connecToMainServertButton)
                .addContainerGap(55, Short.MAX_VALUE))
        );
        connectToMainServerPanelLayout.setVerticalGroup(
            connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(connectToMainServerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ipAddressLabel)
                    .add(ipAddressTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(connectToMainServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(portLabel)
                    .add(portTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(connecToMainServertButton))
                .addContainerGap(41, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout connectToMainServerDialogLayout = new org.jdesktop.layout.GroupLayout(connectToMainServerDialog.getContentPane());
        connectToMainServerDialog.getContentPane().setLayout(connectToMainServerDialogLayout);
        connectToMainServerDialogLayout.setHorizontalGroup(
            connectToMainServerDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(connectToMainServerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        connectToMainServerDialogLayout.setVerticalGroup(
            connectToMainServerDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(connectToMainServerPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        activateSubServerDialog.setTitle("Activate Subserver and Client Listeners");
        activateSubServerDialog.setResizable(false);
        subServerPortLabel.setText("Subserver port:");

        subServerPortTextField.setText("7771");

        clientPortTextField.setText("7770");

        clientPortLabel.setText("Cleint port:");

        settingsButton.setText("OK");
        settingsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                settingsButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout activateSubServerPanelLayout = new org.jdesktop.layout.GroupLayout(activateSubServerPanel);
        activateSubServerPanel.setLayout(activateSubServerPanelLayout);
        activateSubServerPanelLayout.setHorizontalGroup(
            activateSubServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(activateSubServerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(activateSubServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, activateSubServerPanelLayout.createSequentialGroup()
                        .add(subServerPortLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE)
                        .add(subServerPortTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(activateSubServerPanelLayout.createSequentialGroup()
                        .add(clientPortLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 44, Short.MAX_VALUE)
                        .add(clientPortTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(17, 17, 17)
                .add(settingsButton)
                .add(31, 31, 31))
        );
        activateSubServerPanelLayout.setVerticalGroup(
            activateSubServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(activateSubServerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(activateSubServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(subServerPortLabel)
                    .add(subServerPortTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(activateSubServerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(clientPortLabel)
                    .add(clientPortTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(settingsButton))
                .addContainerGap())
        );

        org.jdesktop.layout.GroupLayout activateSubServerDialogLayout = new org.jdesktop.layout.GroupLayout(activateSubServerDialog.getContentPane());
        activateSubServerDialog.getContentPane().setLayout(activateSubServerDialogLayout);
        activateSubServerDialogLayout.setHorizontalGroup(
            activateSubServerDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(activateSubServerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        activateSubServerDialogLayout.setVerticalGroup(
            activateSubServerDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(activateSubServerPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        infoLabel.setText("Connection Error!");

        infoButton.setText("OK");
        infoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                infoButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout infoPanelLayout = new org.jdesktop.layout.GroupLayout(infoPanel);
        infoPanel.setLayout(infoPanelLayout);
        infoPanelLayout.setHorizontalGroup(
            infoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(infoPanelLayout.createSequentialGroup()
                .add(infoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(infoPanelLayout.createSequentialGroup()
                        .add(20, 20, 20)
                        .add(infoButton))
                    .add(infoPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(infoLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 304, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        infoPanelLayout.setVerticalGroup(
            infoPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(infoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(infoLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(infoButton)
                .addContainerGap())
        );

        org.jdesktop.layout.GroupLayout infoDialogLayout = new org.jdesktop.layout.GroupLayout(infoDialog.getContentPane());
        infoDialog.getContentPane().setLayout(infoDialogLayout);
        infoDialogLayout.setHorizontalGroup(
            infoDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(infoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        infoDialogLayout.setVerticalGroup(
            infoDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(infoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Subserver");
        setResizable(false);
        numberOfConnectedClientsLabel.setText("Number of connected clients:");

        mainServerLabel.setText("Main server status:");

        connectedClientsLabel.setText("0");

        mainServerStatusLabel.setText("not connected");

        org.jdesktop.layout.GroupLayout upperPanelLayout = new org.jdesktop.layout.GroupLayout(upperPanel);
        upperPanel.setLayout(upperPanelLayout);
        upperPanelLayout.setHorizontalGroup(
            upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(upperPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(numberOfConnectedClientsLabel)
                    .add(mainServerLabel))
                .add(14, 14, 14)
                .add(upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(connectedClientsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(mainServerStatusLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        upperPanelLayout.setVerticalGroup(
            upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(upperPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(numberOfConnectedClientsLabel)
                    .add(connectedClientsLabel))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(upperPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(mainServerLabel)
                    .add(mainServerStatusLabel))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        fileMenu.setMnemonic('F');
        fileMenu.setText("File");
        showLogDialogItem.setText("Change Log File");
        showLogDialogItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showLogDialogItemActionPerformed(evt);
            }
        });

        fileMenu.add(showLogDialogItem);

        connectToMainServerItem.setMnemonic('C');
        connectToMainServerItem.setText("Connect To Main Server");
        connectToMainServerItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                connectToMainServerItemActionPerformed(evt);
            }
        });

        fileMenu.add(connectToMainServerItem);

        activateSubServerItem.setMnemonic('A');
        activateSubServerItem.setText("Activate Subserver");
        activateSubServerItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                activateSubServerItemActionPerformed(evt);
            }
        });

        fileMenu.add(activateSubServerItem);

        exitItem.setText("Exit");
        exitItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitItemActionPerformed(evt);
            }
        });

        fileMenu.add(exitItem);

        menuBar.add(fileMenu);

        setJMenuBar(menuBar);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(upperPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(upperPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void showLogDialogItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showLogDialogItemActionPerformed
        JFileChooser fc = new JFileChooser();
        String fileName = "log.txt";
        int result = fc.showOpenDialog(this);
                switch(result) {
           case JFileChooser.APPROVE_OPTION:
               // znaci rekli smo izaberi taj fajl
                // ovde pravim fajl
               File newFile = fc.getSelectedFile(); 
               fileName = newFile.getAbsolutePath();
              break;
           case JFileChooser.CANCEL_OPTION: break;
           case JFileChooser.ERROR_OPTION: break;
        }
        showLogDialogItem.setEnabled(false);
    }//GEN-LAST:event_showLogDialogItemActionPerformed

    private void exitItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitItemActionPerformed
        // treba provera da li su sve niti gotove i da zatvorimo sve sockete
        System.exit(0);
    }//GEN-LAST:event_exitItemActionPerformed

    private void infoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_infoButtonActionPerformed
        infoDialog.setVisible(false);
    }//GEN-LAST:event_infoButtonActionPerformed

    private void activateSubServerItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_activateSubServerItemActionPerformed
        this.subServerPortTextField.setText(mySubServer.getSubServerPort()+"");
        this.activateSubServerDialog.setBounds(getX(), getY(), 300, 110);
        this.activateSubServerDialog.setVisible(true);
    }//GEN-LAST:event_activateSubServerItemActionPerformed

    private void settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_settingsButtonActionPerformed
        try {
            mySubServer.setSubServerPort(Integer.parseInt(subServerPortTextField.getText()));
            mySubServer.startSubServerListener();
            mySubServer.setClientPort(Integer.parseInt(clientPortTextField.getText()));
            mySubServer.startClientListener();
            this.activateSubServerItem.setEnabled(false);
            this.activateSubServerDialog.setVisible(false);
        } catch (NumberFormatException ex) {
            setDialogException("Port Format Error", "Port must be an integer!");
        }
    }//GEN-LAST:event_settingsButtonActionPerformed

    private void connecToMainServertButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connecToMainServertButtonActionPerformed
        String host = ipAddressTextField.getText();
        try {
            int port =Integer.parseInt(portTextField.getText());
            
            mySubServer.connectToMainServer(host, port);
            
            mainServerStatusLabel.setText("connected");
            connectToMainServerItem.setEnabled(false);
            connectToMainServerDialog.setVisible(false);
        } catch (NumberFormatException ex) {
            mySubServer.writeLog("SubServerWindow: NumberFormatException: " + ex);
            setDialogException("Port Format Error", "Port must be an integer!");
        } catch (SocketException ex){
            mySubServer.writeLog("SubServerWindow: SocketException: " + ex);
            connectToMainServerDialog.setVisible(false);
            setDialogException("Connection Error",  "Main server connection error.");
        } catch (SocketTimeoutException ex){
            mySubServer.writeLog("SubServerWindow: SocketTimeoutException: " + ex);
            connectToMainServerDialog.setVisible(false);
            setDialogException("Connection Error", "Main server timeout!");
        } catch (UnknownHostException ex){
            mySubServer.writeLog("SubServerWindow: UnknownHostException: " + ex);
            connectToMainServerDialog.setVisible(false);
            setDialogException("Unknow Host", "Cannot connect to host: " + host);
        } catch (IOException ex){
            mySubServer.writeLog("SubServerWindow: IOException: " + ex);
            connectToMainServerDialog.setVisible(false);
            setDialogException("Connection Error", "Problems with input/output operations");
        } 
    }//GEN-LAST:event_connecToMainServertButtonActionPerformed

    private void connectToMainServerItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectToMainServerItemActionPerformed
        this.connectToMainServerDialog.setBounds(this.getX(), this.getY(), 400,100);
        this.connectToMainServerDialog.setVisible(true);
    }//GEN-LAST:event_connectToMainServerItemActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new SubServerWindow().setVisible(true);
            }
        });
    }
    
    private static void setLookAndFeel(){
           
    // Install a different look and feel; specifically, the Windows look and feel
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (InstantiationException e) {
        } catch (ClassNotFoundException e) {
        } catch (UnsupportedLookAndFeelException e) {
        } catch (IllegalAccessException e) {
        }
    }
    
    public void setConnctedClientsLabel(String s){
        connectedClientsLabel.setText(s);
    }
    
    public void setDialogException(int x, int y, String title, String text){
        infoDialog.setTitle(title);
        infoDialog.setBounds(this.getX(), this.getY(), x, y);
        infoLabel.setText(text);
        infoDialog.setVisible(true);
    } 
    
    public void setDialogException(String title, String text){
        setDialogException(200, 100, title, text);
    } 
    
    public void setConnectToMainServerItem(boolean b){
        connectToMainServerItem.setEnabled(b);
    }
    
    public void setActivateSubServerItem(boolean b){
        activateSubServerItem.setEnabled(b);
    }
    
    public void setMainServerStatusLabel(String s){
        mainServerStatusLabel.setText(s);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDialog activateSubServerDialog;
    private javax.swing.JMenuItem activateSubServerItem;
    private javax.swing.JPanel activateSubServerPanel;
    private javax.swing.JLabel clientPortLabel;
    private javax.swing.JTextField clientPortTextField;
    private javax.swing.JButton connecToMainServertButton;
    private javax.swing.JDialog connectToMainServerDialog;
    private javax.swing.JMenuItem connectToMainServerItem;
    private javax.swing.JPanel connectToMainServerPanel;
    private javax.swing.JLabel connectedClientsLabel;
    private javax.swing.JMenuItem exitItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JButton infoButton;
    private javax.swing.JDialog infoDialog;
    private javax.swing.JLabel infoLabel;
    private javax.swing.JPanel infoPanel;
    private javax.swing.JLabel ipAddressLabel;
    private javax.swing.JTextField ipAddressTextField;
    private javax.swing.JLabel mainServerLabel;
    private javax.swing.JLabel mainServerStatusLabel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JLabel numberOfConnectedClientsLabel;
    private javax.swing.JLabel portLabel;
    private javax.swing.JTextField portTextField;
    private javax.swing.JButton settingsButton;
    private javax.swing.JMenuItem showLogDialogItem;
    private javax.swing.JLabel subServerPortLabel;
    private javax.swing.JTextField subServerPortTextField;
    private javax.swing.JPanel upperPanel;
    // End of variables declaration//GEN-END:variables
    
    SubServer mySubServer = null;
}
